import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const router = new VueRouter({
    // saveScrollPosition: true,
    scrollBehavior(to,from,savePosition){ // 在点击浏览器的“前进/后退”，或者切换导航的时候触发。
        if(savePosition) {
            return savePosition;
        }else{
            return {x:0,y:0}
        }
    },
    routes: [
        {
            path: '/login/index',
            meta: {dialog: true, title: '登陆'},
            component: require('./page/login/Login.vue').default,
            props: {dialog: true}
        },
        {
            path: '/',//后台框架页面
            component: require('./components/layout/Index.vue').default,
            children: [
                //    弹窗类组件
                // {
                //     path: '/dialog/login/index',
                //     meta: {dialog: true, title: '账户详情'},
                //     component: require('./page/dialog/AccountDetail.vue').default,
                //     props: {dialog: true}
                // },
                // {
                {
                    path: '/dialog/show/user.driver/:id?',
                    meta: {dialog: true, title: '司机',width: 'w800'},
                    component: require('./page/dialog/DriverDetail.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/line/user.driver/:driverId?',
                    meta: {dialog: true, title: '司机轨迹', width:'w1000'},
                    component: require('./page/dialog/DriverTrajectory.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/show/common.user/:id?',
                    meta: {dialog: true, title: '用户详情',width: 'w800'},
                    component: require('./page/dialog/UserDetail.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/show/express.order/:id?',
                    meta: {dialog: true, title: '订单详情',width: 'w800'},
                    component: require('./page/dialog/OrderDetail.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/assign/express.order/:id?/:driver_id?',
                    meta: {dialog: true, title: '快件指派',width: 'w800'},
                    component: require('./page/dialog/ExpressAssignment.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/control/express.order/:id?',
                    meta: {dialog: true, title: '快件批量接管',width: 'w800'},
                    component: require('./page/dialog/ExpressControlJieGuan.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/cancel/express.order/:id?',
                    meta: {dialog: true, title: '取消订单',width: 'w800'},
                    component: require('./page/dialog/CancelTask.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/show/express.mission/:id?',
                    meta: {dialog: true, title: '任务详情',width: 'w800'},
                    component: require('./page/dialog/TaskDetail.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/see/user.driver/:id?',
                    meta: {dialog: true, title: '看板详情',width: 'w800'},
                    component: require('./page/dialog/KanBanDetail.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/address/express.order/:id?',
                    meta: {dialog: true, title: '运单位置',width: 'w1000'},
                    component: require('./page/dialog/SeeOrderAddress.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/show/express.spot/:id?',
                    meta: {dialog: true, title: '接驳点详情',width: 'w700'},
                    component: require('./page/dialog/SpotInfo.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/see/express.order/:id?',
                    meta: {dialog: true, title: '选中运单分布图',width: 'w1000'},
                    component: require('./page/dialog/SeeOrderDistributionMap.vue').default,
                    props: {dialog: true}
                },
                {
                    path: '/dialog/operation/money.invoice/:id?',
                    meta: {dialog: true, title: '操作发票',width: 'w600'},
                    component: require('./page/dialog/Invoice.vue').default,
                    props: {dialog: true}
                },
                // {
                //     path: '/dialog/edit/money.record/:id?',
                //     meta: {dialog: true, title: '充值'},
                //     component: require('./page/dialog/TaskDetail.vue').default,
                //     props: {dialog: true}
                // },
                {
                    path: '/dialog/show/:model/:id?',
                    meta: {dialog: true, title: '编辑',width: 'w800'},
                    component: require('./page/dialog/CommonForm.vue').default,
                    props: true
                },
                {
                    path: '/dialog/edit/:model/:id?',
                    meta: {dialog: true, title: '编辑',width: 'w800'},
                    component: require('./page/dialog/CommonForm.vue').default,
                    props: true
                },
                // {
                //     path: '/dialog/login/index',
                //     meta: {dialog: true, title: '预警详情'},
                //     component: require('./page/dialog/EarlyWarningDetail.vue').default
                //     props: {dialog: true}
                // },
                // {
                //     path: '/dialog/login/index',
                //     meta: {dialog: true, title: '位置选择'},
                //     component: require('./page/dialog/SelectAddress.vue').default
                //     props: {dialog: true}
                // },
                {
                    path: '/dialog/curd/:model/:actn?/:query?/',
                    meta: {dialog: true, title: '数据操作'},
                    component: require('./page/dialog/CommonTable.vue').default,
                    props: {dialog: true}
                },

                // {
                //     path: '/dialog/:model/:actn?/:query?/',
                //     meta: {dialog: true, title: '地图操作'},
                //     component: require('./page/dialog/CommonMap.vue').default,
                //     props: {dialog: true}
                // },
                //    弹窗类组件
                {
                    path: '/',
                    component: require('./page/Index.vue').default,
                    redirect: '/order/noworder'
                },
                {
                    path: '/demo',
                    component: require('./page/Demo.vue').default
                },
                {
                    path: '/express/dispatch',  // 待调度
                    component: require('./page/dispatchManagement/express/dispatch/index.vue').default
                },
                {
                    path: '/dispatch/warning',  // 调度预警
                    component: require('./page/dispatchManagement/dispatchWarning/index.vue').default
                },
                {
                    path: '/driver/driverLook',  // 司机看板
                    component: require('./page/dispatchManagement/driverKanBan/Index.vue').default
                },
                {
                    path: '/curd/express.warning', //异常处理
                    component: require('./page/dispatchManagement/addressAbnormal/index.vue').default
                },

                {
                    path: '/search/address',// 地址搜索
                    component: require('./page/customerServiceManagement/searchAddress/Index.vue').default,
                },
                {
                    path: '/order/detail/:id',
                    component: require('./page/orderManagement/orderDetail/Index.vue').default
                    // props: true
                },
                {
                    path: '/curd/express.mission',
                    component: require('./page/dispatchManagement/express/taskManagement/index.vue').default
                },
                {
                    path: '/db/my', // 个人统计页面
                    component: require('./page/statisticalManagement/personalStatistics/personIndex.vue').default
                },
                {
                    path: '/auth/list/:id?', // 权限设置页面
                    component: require('./page/accountManagement/permissonsSettings/Index.vue').default
                },
                {
                    path: '/express/express_map',
                    component: require('./page/dispatchManagement/express/expressMap/ExpressMap.vue').default
                },
                {
                    path: '/express/map_dispatch',
                    component: require('./page/dispatchManagement/keShiHuaDispatch/Index.vue').default
                },
                {
                    path: '/express/abnormal',
                    component: require('./page/dispatchManagement/abnormalReport/Index.vue').default
                },
                {
                    path: '/curd/express.area',  // 区域
                    component: require('./page/operationManagement/area/index.vue').default
                },
                {
                    path: '/curd/express.spot',  // 站点设置
                    component: require('./page/operationManagement/site/Index.vue').default
                },

                {
                    path: '/curd/express.order', // 运单搜索列表
                    component: require('./page/orderManagement/orderSearch/index.vue').default
                },
                {
                    path: '/curd/money.invoice', // 发票管理 配置版本
                    component: require('./page/financialManagement/invoice/InvoicesTable.vue').default
                },
                // {
                //     path: '/curd/money.invoice', // 发票管理
                //     component: require('./page/financialManagement/invoice/Invoices.vue').default
                // },
                {
                    path: '/order/noworder', // 当前运单
                    component: require('./page/orderManagement/nowOrder/index.vue').default
                },
                {
                    path: '/curd/user.driver',
                    component: require('./page/accountManagement/driver/index.vue').default
                },
                {
                    path: '/curd/money.record',  // 财务流水
                    component: require('./page/financialManagement/finance/Index.vue').default
                },
                {
                    path: '/data/export',  // 数据导出
                    component: require('./page/statisticalManagement/export/ExportData.vue').default
                },
                {
                    path: '/data/batch_export',  // 数据批量导出（队列）
                    component: require('./page/statisticalManagement/export/BatchExport.vue').default
                },
                {
                    path: '/day/daily_report',  // 每日日报
                    component: require('./page/statisticalManagement/daily/DayReportForm.vue').default
                },
                {
                    path: '/day/daily_report/type',  // 每日日报type=all
                    component: require('./page/statisticalManagement/daily/DayReportFormType.vue').default
                },
                {
                    path: '/config/',
                    component: require('./page/Config.vue').default,
                    children: [
                        {
                            path: 'edit/:model/:id',
                            meta: {dialog: true, title: '编辑'},
                            components: {
                                dialog: require('./components/module/Form.vue').default
                            },
                            props: {dialog: true},
                        }
                    ]
                },
                {
                    path: '/empty/route',//404
                    component: require('./page/emptyRouter/empty.vue').default
                },
                {
                    path: 'curd/:model/:actn?/:query?/',
                    component: require('./page/List.vue').default,
                },
                {
                    path: '/edit/:model/:id?',
                    component: require('./page/Edit.vue').default
                },
                {
                    path: '/show/:model/:id?',
                    component: require('./page/Show.vue').default
                },

                {
                    path: '/im/:id?',
                    component: require('./components/module/IM.vue').default
                },
                {
                    path: '*',//404
                    component: require('./page/404.vue').default
                }

            ]
        },

    ]
});

export default router;
